// 引入mockjs
// https://github.com/nuysoft/Mock/wiki/Getting-Started
const Mock = require('mockjs')
Mock.setup({
    timeout: '1000' // 区间随机超时时间
})
// 引入首页接口mock
require('./homeData.js')(Mock)
const getMockData = {
    info(options) {
        return {
            "code": 0,
            "data": {
                "userName": "132",
                "userCode": "123"
            },
            "message": "\u6210\u529F"
        }
    }
}
const postMockData = {
    code(options) {
        let argObj = JSON.parse(options.body)
        return {
            "code": 0,
            "data": Mock.mock({
                "deptCodeSet|1-20": [...new Set([
                    () => {
                        return argObj.node + Mock.mock('@string("upper", 3)')
                    }
                ])]
            }),
            "message": "\u6210\u529F"
        }
    }

}

/* Mock.mock( url, get , 返回的数据) */
// Mock.mock(RegExp(url + ".*"), 'get', getMockData.info)

/* Mock.mock( url, post , 返回的数据) */
Mock.mock(/\/api\/msdk\/proxy\/query_common_credit/, 'post', (req) => {
    return {
        data: [{
                title: "果汁网",
                value: "众多有趣的网站",
                href: "http://www.guozhivip.com/",
                tag: "娱乐",
                id: 1
            },
            {
                title: "果汁网",
                value: "众多有趣的网站",
                href: "http://www.guozhivip.com/",
                tag: "娱乐",
                id: 2
            },
            {
                title: "元气壁纸",
                value: "正版网址",
                href: "http://desk.duba.com",
                tag: "美化",
                id: 3
            },
            {
                title: "码云",
                value: "码农聚集地",
                href: "https://gitee.com/",
                tag: "编程",
                id: 4
            },
            {
                title: "小爱同学",
                id: 5,
                value: "真爱粉真爱粉真爱粉真爱粉真爱粉真爱粉真爱粉真爱粉真爱粉真爱粉",
                href: "https://www.microsoft.com/zh-cn/p/%E5%B0%8F%E7%88%B1%E5%90%8C%E5%AD%A6/9mw76kfhnz0c?activetab=pivot:overviewtab#",
            },
            {
                title: "语雀",
                value: "",
                href: "https://www.yuque.com/dashboard/my_books",
                tag: "工具",
                id: 6
            },
            {
                title: "搜索",
                value: "相当于百度",
                href: "https://cn.bing.com/",
                id: 7
            },
            {
                title: "VUECLI3",
                href: "https://cli.vuejs.org/zh/guide/",
                id: 8
            },
        ],
        code: 'scssess',
        msg: "请求成功"
    }
})

